<%@ Page Language="C#" MasterPageFile="~/ProductsMaster.master" AutoEventWireup="true"
    CodeFile="Products.aspx.cs" Inherits="Products" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="pageContent" runat="Server">
    <table width="100%">
        <tr>
            <td colspan="3">
                <span style="font-size: 48pt; color: #6c0e0e; font-family: Impact"><em>C</em></span>
                <span style="font-size: 48pt; color: #7c0e0e; font-family: Impact"><em>o</em></span>
                <span style="font-size: 48pt; color: #8c0e0e; font-family: Impact"><em>o</em></span>
                <span style="font-size: 48pt; color: #9c0e0e; font-family: Impact"><em>l&nbsp;</em></span>
                <span style="font-size: 48pt; color: #ac0e0e; font-family: Impact"><em>S</em></span>
                <span style="font-size: 48pt; color: #bc0e0e; font-family: Impact"><em>t</em></span>
                <span style="font-size: 48pt; color: #cc0e0e; font-family: Impact"><em>u</em></span>
                <span style="font-size: 48pt; color: #dc0e0e; font-family: Impact"><em>f</em></span>
                <span style="font-size: 48pt; color: #ec0e0e; font-family: Impact"><em>f</em></span>
                <span style="font-size: 48pt; color: #fc0e0e; font-family: Impact"><em>!</em></span>
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <asp:Label ID="Label1" runat="server" Font-Bold="True" ForeColor="#0E0E6C" Text="Categories:"></asp:Label>&nbsp;<asp:DropDownList
                    ID="ddCategory" runat="server" AutoPostBack="True" DataSourceID="dsCategory"
                    DataTextField="Name" DataValueField="ProductCategoryID">
                </asp:DropDownList>
                <asp:SqlDataSource ID="dsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:AdvWorks %>"
                    SelectCommand="SELECT Name, ProductCategoryID FROM Production.ProductCategory ORDER BY Production.ProductCategory.Name">
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td valign="top" width="1%">
                <asp:GridView ID="gvwSubcategories" runat="server" AutoGenerateColumns="False" DataKeyNames="ProductSubcategoryID"
                    DataSourceID="dsSubcategory" ForeColor="#0E0E6C" GridLines="None">
                    <Columns>
                        <asp:BoundField DataField="Name" HeaderText="Subcategories" SortExpression="Name" />
                        <asp:CommandField SelectText="[&gt;]" ShowSelectButton="True" SelectImageUrl="~/Images/AdvRect.gif" />
                    </Columns>
                    <SelectedRowStyle BackColor="#FFC0C0" Font-Bold="True" />
                    <RowStyle Wrap="False" />
                </asp:GridView>
                <asp:SqlDataSource ID="dsSubcategory" runat="server" ConnectionString="<%$ ConnectionStrings:AdvWorks %>"
                    SelectCommand="SELECT ProductCategoryID, ProductSubcategoryID, Name FROM Production.ProductSubcategory WHERE (ProductCategoryID = @ProductCategoryID)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddCategory" Name="ProductCategoryID" PropertyName="SelectedValue" />
                    </SelectParameters>
                </asp:SqlDataSource>
                &nbsp;&nbsp;
            </td>
            <td valign="top" width="1%">
                <asp:GridView ID="gvwProduct" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    DataKeyNames="ProductID" DataSourceID="dsProduct" ForeColor="#0E0E6C" GridLines="None">
                    <Columns>
                        <asp:BoundField DataField="Name" ShowHeader="False" SortExpression="Name" HeaderText="Products">
                            <ItemStyle Wrap="False" />
                        </asp:BoundField>
                        <asp:CommandField SelectText="[&gt;]" ShowSelectButton="True" />
                    </Columns>
                    <SelectedRowStyle BackColor="#FFC0C0" Font-Bold="True" />
                    <PagerSettings Mode="NextPrevious" NextPageText="[Next]" PreviousPageText="[Previous]" />
                    <RowStyle Wrap="False" />
                    <EmptyDataTemplate>
                        Please&nbsp;select&nbsp;a&nbsp;Subcategory
                    </EmptyDataTemplate>
                </asp:GridView>
                <asp:SqlDataSource ID="dsProduct" runat="server" ConnectionString="<%$ ConnectionStrings:AdvWorks %>"
                    SelectCommand="SELECT ProductID, ProductSubcategoryID, Name FROM Production.Product WHERE (ProductSubcategoryID=@ProductSubcategoryID)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="gvwSubcategories" Name="ProductSubcategoryID" PropertyName="SelectedValue" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
            <td valign="top">
                <asp:DetailsView ID="dvwProduct" runat="server" AutoGenerateRows="False" BackColor="#FFC0C0"
                    BorderColor="#C0C0FF" BorderStyle="Solid" DataSourceID="dsProductDetails" ForeColor="#0E0E6C"
                    GridLines="None" Height="50px" Width="100%">
                    <Fields>
                        <asp:BoundField DataField="Name" HeaderText="Product" SortExpression="Name" />
                        <asp:BoundField DataField="Color" HeaderText="Color" SortExpression="Color" />
                        <asp:BoundField DataField="ListPrice" HeaderText="Price" SortExpression="ListPrice" />
                        <asp:TemplateField>
                            <ItemTemplate>
                                <a href='ProductDetails.aspx?ProductID=<%# Eval("ProductID") %>' style="color: #0e0e6c">
                                    [More Details...]</a>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <a href='ProductReview.aspx?ProductID=<%# Eval("ProductID") %>&ProductName=<%# Eval("Name") %>'
                                    style="color: #0e0e6c">[Product Reviews...]</a>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Fields>
                </asp:DetailsView>
                <asp:SqlDataSource ID="dsProductDetails" runat="server" ConnectionString="<%$ ConnectionStrings:AdvWorks %>"
                    SelectCommand="SELECT ProductID, Name, Color, ListPrice FROM Production.Product WHERE (ProductID=@ProductID)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="gvwProduct" Name="ProductID" PropertyName="SelectedValue" />
                    </SelectParameters>
                </asp:SqlDataSource>
                &nbsp; &nbsp;
            </td>
        </tr>
    </table>
</asp:Content>
